/**
 * Copyright (c) 2021-2030, NDWP.
 * <p>
 */
package com.example.waternetwork.api.system.entity;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * LoginUser
 *
 * @ Author     ：Chenyong.
 * @ Date       ：Created in 10:40 2025/6/23
 */
public class LoginUser extends User implements UserDetails {
    private Collection<? extends GrantedAuthority> authorities;
    public LoginUser(Long id ,String username, String name,  Collection<? extends GrantedAuthority> authorities) {
        this.username = username;
        this.id  = id;
        this.name = name;
        this.authorities = authorities;
    }

    public Long getId() {
        return this.id;
    }
    public String getName() {
        return this.name;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true; // 可按需定制
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}